 function createReader(file) {
	  
	  var reader = new FileReader();
	  reader.onload = function(evt) {
		  var image = new Image();
		  image.onload = function(evt) {
			  var canvas = document.createElement('canvas');
			  var ctx = canvas.getContext('2d');
			  var ratio = Math.min(maxwidth / this.width, maxheight / this.height, 1);
			  var width = Math.round(this.width * ratio);
			  var height = Math.round(this.height * ratio);
			  var img = null;
			  canvas.width = width;
			  canvas.height = height;
			  ctx.drawImage(image,0,0, width, height);
			  img = document.createElement("img");
			  img.src = canvas.toDataURL(file.type);
			  $(img).addClass('thumbnail');
			  $(img).css('opacity',0);
			  $("#photo_container").html('');
			  $("#photo_container").append(img);
			  $("#photo_container").animate({height:height,width:width},{duration:500, complete:function(){$(img).animate({opacity:1},'fast')} });
		  };
	  
		  image.onerror = function() {
			  message("+= " + file.name + " does not look like a valid image");
		  };
		  
		  image.src = evt.target.result;
	  };
	  
	  reader.readAsDataURL(file);
  }
  
  function load_img(url){
	  var image = new Image();
	  $(image).css('opacity',0);
	  image.src = url;
	  image.onload = function(evt) {
		  var ratio = Math.min(maxwidth / this.width, maxheight / this.height, 1);
		  var width = Math.round(this.width * ratio);
		  var height = Math.round(this.height * ratio);
		  var img = this;
		  $(img).addClass('thumbnail');
		  $("#photo_container").html('');
		  $("#photo_container").append(img);
		  $("#photo_container").animate({height:height,width:width},{duration:500, complete:function(){$(img).animate({opacity:1},'fast')} });
	  };
  }
  
  function center_photo(photo){
	  var photo_container = $(photo).parent();
	// dimensiones de la ventana del explorer 
	   var wscr = $(photo_container).width();
	   var wcnt = $(photo).width() + parseInt($(photo).css('padding-left')) + parseInt($(photo).css('padding-right'));
	// obtener posicion central
	   var mleft = ( wscr - wcnt ) / 2;
	// estableciendo ventana modal en el centro
	   $(photo).css("left", mleft+'px');
	  
  }